﻿//
// Copyright (c) 2024 BPer
//
#ifndef SRC_BPERICE_BPERICE_H_
#define SRC_BPERICE_BPERICE_H_

#include <bperice/BPerRtcStun.h>
#include <bperice/BPerRtcSocket.h>
#include <bperice/BPerTurnConnection.h>

#include <bperutil/BPerAvType.h>
#include <bperutil/BPerAvInfoType.h>

typedef struct{
	int32_t uid;
	int32_t localPort;
	BPerBool isTurnAllocated;
	BPerBool isTurnReady;
	BPerSocketProtocol turnSocketProtocol;
	BPerSocketProtocol rtcSocketProtocol;
	BPerIceCandidateType candidateType;
	BPerIceCandidateState iceState;
	BPerTurnConnection* turnconn;
	BPerIceServer server;
	BPerRtcStun stun;
	BPerIceCallback callback;
}BPerIceSession;

typedef struct{
	BPerIceSession session;
	int32_t (*initIce)(BPerIceSession *session);
	int32_t (*iceHandle)(BPerIceSession* session,void* rtcSession,bPer_turn_receive receive,char* remoteIp,int32_t remotePort);
}BPerIce;

void bPer_create_ice(BPerIce* ice,BPerStreamConfig* config,BPerAVInfo* avinfo);
void bPer_destroy_ice(BPerIce* ice);

#endif /* SRC_BPERICE_BPERICE_H_ */
